package com.snap.vseries;

import android.provider.Settings;

/**
 * 存放app的一些配置项及默认参数
 *
 * @author Rachel
 */
public class AppConfig {

    public static final String USER_ID = Settings.Secure.getString(MoleApplication.get().getContentResolver(), Settings.Secure.ANDROID_ID);
    /**
     * 项目文件主路径
     */
    public static final String ROOT_DIRECTORY = "/" + BuildConfig.APK_FILE_NAME_PREFIX + "/";
    /**
     * 模板路径
     */
    public static final String TEMPLATE_DIRECTORY = ROOT_DIRECTORY + "Template/";
    /**
     * 历史数据路径
     */
    public static final String EXPERIMENT_DIRECTORY = ROOT_DIRECTORY + "Experiment/";
    /**
     * 实验日志目录
     */
    public static final String EXP_LOG_DIRECTORY = ROOT_DIRECTORY + "ExpLog";
    /**
     * 操作日志目录
     */
    public static final String LOG_DIRECTORY = ROOT_DIRECTORY + "UserLog";
    /**
     * excel文件导出目录
     */
    public static final String EXCEL_DIRECTORY = ROOT_DIRECTORY + "Excel/";
    /**
     * 图片保存路径
     */
    public static final String IMG_DIRECTORY = ROOT_DIRECTORY + "Screenshot/";
    /**
     * /总共通道数量
     */
    public static final int TOTAL_CHANNEL_COUNT = 4;

    /* 硬件配置项目*/
    /**
     * 温度种类:4种,分别为37 55 72 94
     */
    public static final int TEMP_TYPE_COUNT = 4;
    public static final String[] CHANNEL_NAMES = {"FAM", "VIC", "ROX", "CY5"};
    /**
     * 总共孔位数量
     */
    public static final int TOTAL_HOLE_COUNT = 1;
    /**
     * 超时时间
     */
    public static final int TIMEOUT = 1000 * 6;

    /*一些默认值*/
    /**
     * 环境温度默认值
     */
    public static final float DEF_ENV_TEMP = 50f;
    /**
     * 荧光校准目标值
     */
    public static final int DEF_LIGHT_BASE = 2000;
    /**
     * Ct值默认分析方法
     */
    public static final int DEF_CALC_STRATEGY = Constants.CALC_STRATEGY_CURVATURE;
    /**
     * 升温速率
     */
    public static final float INCREASE_VELOCITY = 2.8f;
    /**
     * 降温速率
     */
    public static final float DECREASE_VELOCITY = 2.8f;
    /**
     * 最小循环数
     */
    public static final int COEFF_ADJUST_MIN_CYCLE = 10;

    /*荧光校准*/
    /**
     * 忽略前n个数据
     */
    public static final int COEFF_ADJUST_IGNORE_CYCLE = 5;
    /**
     * Pid默认值--P
     */
    public static final String PID_DEFAULT_P = "0.2";

    /* Pid默认值*/
    /**
     * Pid默认值--I
     */
    public static final String PID_DEFAULT_I = "0.0009";
    /**
     * Pid默认值--D
     */
    public static final String PID_DEFAULT_D = "0.0015";
    /**
     * 数据库文件存储目录
     */
    static final String DATABASE_DIRECTORY = ROOT_DIRECTORY + "Database";
    /**
     * 采光间隔20s/一次
     */
    public static final long PER_LIGHT_TIME = 20;

    public static class Dynamic {
        public static boolean analysis_debug_mode = false;//调试分析算法开关
        /**
         * 是否调试原始荧光（实验运行中）
         */
        public static boolean exp_running_debug_origin_light = false;
        /**
         * 是否显示温度数值  慢慢衍生成了 调试温度的开关
         */
        public static boolean show_temp_value = true;

        /**
         * 是否开启用户自定义设置入口
         * 目前控制：new实验的自定义入口
         * 结果页的信息模块的删除按钮是否显示
         * 结果页分析模块，通道选择按钮是否显示
         * home页添加实验项目的按钮是否显示
         * 模板界面的删除按钮是否显示
         * 温漂设置
         * PID设置
         */
        public static boolean custom_setting = true;
        /**
         * 权限：普通用户、开发者
         * 目前控制：结果页日志模块是否显示
         */
        public static boolean developer_permission = false;
        /**
         * 显示拟合过程的开关（实验结果-相对荧光）
         */
        public static boolean exp_detail_show_fit_step = false;
        /**
         * 进行自动荧光校准的开关（4 bit)
         */
        public static int calc_light_coeff_flag = 0;
    }

    //硬件配置项目 v1min目前用的脉冲屏
//    public static final String SERIAL_PORT = "/dev/ttyMT2";//亿云付
//    public static final String SERIAL_PORT = "/dev/ttyS3";// 迈冲5.8小板的485口
    public static final String SERIAL_PORT = "/dev/ttyS4";// 迈冲其它板的485口
    public static final int SERIAL_BAUD_RATE = 115200;
    public static final int GROUP_COUNT = 1;//一共多少组

    //指令配置项目
    public static final byte CMD_START1 = (byte) 0xa5;
    public static final byte CMD_START2 = (byte) 0x5a;
    public static final int DEVICE_TYPE = 1;//设备号 指令中用到
    public static final int LIGHTING_MODULE_INDEX = 0x30;//采光指令相关时使用的模块号

    //电机角度和仓位的关系
    public static final float[][] HOLE_ANGLE = {
            {0f, 110.15f, 138.15f, 166.15f, 194.15f, 250.15f, 278.15f, 306.15f, 334.15f, 26.15f, 54.15f},
            {0f, 290.15f, 318.15f, 346.15f, 14.15f, 70.15f, 98.15f, 126.15f, 154.15f, 206.15f, 234.15f}};
    public static final String[] DEVICES = {"A","B","C","D","E","F","G","H"};
}
